package com.da.javatest.interview.session2;

import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArraySet;

/**
 * @author chenlida
 * @date 2020/3/29 16:20
 */
public class Test08HashSet {
    public static void main(String[] args) {
        //Set<String> set = new HashSet<>();
        Set<String> set = new CopyOnWriteArraySet<>();

        for (int i = 0; i < 30; i++) {
            new Thread(() -> {
                String uuid = UUID.randomUUID().toString().substring(0, 4);
                set.add(uuid);
                System.out.println(set);
            }).start();
        }
    }
}
